package com.welfare.common.enums;

import java.util.Objects;

/**
 * 是否在职
 */
public enum WorkStateEnum {
    MARRIED(1, "在职"), UN_MARRIED(0, "离职");

    private Integer code;

    private String desc;

    WorkStateEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }
        for (WorkStateEnum workStateEnum : WorkStateEnum.values()) {
            if (workStateEnum.code.equals(code)) {
                return workStateEnum.desc;
            }
        }
        return null;
    }
}
